<template>
  <div>
    <!-- 选题 -->
    <el-form :inline="true" :model="formInline" class="demo-form-inline">
      <el-form-item label="科目">
        <el-select v-model="formInline.region" placeholder="请选择科目">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="册次">
        <el-select v-model="formInline.region" placeholder="请选择册次">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="教材">
        <el-select v-model="formInline.region" placeholder="请选择教材">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item label="状态">
        <el-select v-model="formInline.region" placeholder="请选择状态">
          <el-option label="区域一" value="shanghai"></el-option>
          <el-option label="区域二" value="beijing"></el-option>
        </el-select>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmit()">添加</el-button>
        <el-button type="primary" @click="addUpdateCourse()">删除</el-button>
      </el-form-item>
    </el-form>
    <el-table
      :data="tableData"
      border
      style="width: 100%"
      @selection-change="handleSelectionChange"
      header-cell-class-name="thead"
    >
      <el-table-column type="selection" width="55"></el-table-column>
      <el-table-column fixed="right" label="教辅信息" width="300">
        <template slot-scope="scope">
          <p>七年级语文知识点全面讲解，考点一网打尽</p>
          <p>七年级语文知识点全面讲解，考点一网打尽</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="状态">
        <template slot-scope="scope">
          <el-tag>进行中</el-tag>
          <el-tag type="success">已完成</el-tag>
          <el-tag type="info">待指派</el-tag>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="创建时间">
        <template slot-scope="scope">
          <p>主讲：刘红霞、王云飞</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="已录入">
        <template slot-scope="scope">
          <p>正价课</p>
        </template>
      </el-table-column>
      <el-table-column fixed="right" label="操作">
        <template slot-scope="scope">
          <a>查看</a> |
          <el-dropdown>
            <span class="el-dropdown-link">
              <a>
                更多
                <i class="el-icon-arrow-down el-icon--right"></i>
              </a>
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item>指派</el-dropdown-item>
              <el-dropdown-item>修改</el-dropdown-item>
              <el-dropdown-item>删除</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </template>
      </el-table-column>
    </el-table>
    <el-pagination
      @size-change="sizeChangeHandle"
      @current-change="currentChangeHandle"
      :current-page="pageIndex"
      :page-sizes="[10, 20, 50, 100]"
      :page-size="pageSize"
      :total="totalPage"
      layout="total, sizes, prev, pager, next, jumper"
    ></el-pagination>
  </div>
</template>
<script>
export default {
  data () {
    return {
      isSave: false,
      multipleSelection: [],
      fuck: false,
      pageIndex: 1,
      value: 2,
      value2: 3,
      pageSize: 10,
      totalPage: 0,
      formInline: {
        user: '',
        region: ''
      },
      tableData: [
        {
          date: '2016-05-02',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1518 弄'
        },
        {
          date: '2016-05-04',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1517 弄'
        },
        {
          date: '2016-05-01',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1519 弄'
        },
        {
          date: '2016-05-03',
          name: '王小虎',
          address: '上海市普陀区金沙江路 1516 弄'
        }
      ]
    }
  },
  methods: {
    handleSelectionChange (val) {
      this.multipleSelection = val
      console.log(this.multipleSelection)
    },
    setCourseTerm () {
      this.$router.push({ name: 'course-term' })
    },
    setClassHour () {
      this.$router.push({ name: 'class-hour' })
    },
    addUpdateCourse () {
      this.$router.push({ name: 'add-update-class' })
    },
    onSubmit () {
      console.log('submit!')
    },
    // 每页数
    sizeChangeHandle (val) {
      this.pageSize = val
      this.pageIndex = 1
      this.getDataList()
    },
    // 当前页
    currentChangeHandle (val) {
      this.pageIndex = val
      this.queryPageList()
    }
  }
}
</script>
<style scoped>
.z-display-flex {
  display: flex;
}
a {
  cursor: pointer;
}
</style>
